const Cat = {
  name: "小猫",
  age: 1
};

const Dog0 = {
  name: "小狗",
  age: 3
};

/**
 * keyof的妙用
 * @param obj 对象
 * @param prop 属性
 * @returns 对象里属性对应的值
 */
function hander<O extends object, P extends keyof O>(obj: O, prop: P) {
  console.log(obj[prop]);
}

/* hander(Cat, "name");
hander(Dog0, "name"); */
